package com.woniu.tank.tank;


import java.awt.Graphics;
import java.awt.Image;

import javax.swing.JPanel;

import com.woniu.tank.ui.GamePanel;

public class Tank {
	//坦克坐标
	public int x;
	public int y;
	//移动
	protected int step = 0;
	//方向
	protected int dir;
	//定义坏坦克的子弹是否好坏
	protected boolean good;
	//定义坦克存活
	public boolean live = true;
	GamePanel tc;

	//坦克原地踏步
	public void step(){
		if(step==1){
			step--;
		}else{
			step++;
		}
	}
	//角色钻草丛
	public void underGrass(Graphics g, JPanel p , Image image){
		if(GamePanel.map[y][x]==3){
			g.drawImage(image, (x*32)-3, (y*32)-3, ((x+1)*32)+3, ((y+1)*32)+3, 64, 0, 96, 32, p);
		}
	}
	public boolean isGood() {
		return good;
	}
	public void setGood(boolean good) {
		this.good = good;
	}
	public boolean isLive() {
		return live;
	}
	public void setLive(boolean live) {
		this.live = live;
	}
	public Tank(int x, int y,GamePanel tc) {
		this.x = x;
		this.y = y;
		this.step = 0;
		this.dir = 0;
		this.tc= tc;
	}
	public Tank(int x, int y){
		this.x=x;
		this.y=y;
	}
	public Tank() {}
}
